//
//  ReportCollectionViewCell.m
//  markmap
//
//  Created by 甘世清 on 2024/5/12.
//

#import "ReportCollectionViewCell.h"

@implementation ReportCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.masksToBounds = YES;
        [self SQ_UIViewForSelfView];
    }
    return self;
}
/// 添加ui
-(void)SQ_UIViewForSelfView
{
    self.contentView.layer.cornerRadius = 10;
    self.contentView.clipsToBounds = YES;
    self.contentView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.leftImage];
    [self.leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(18);
            make.centerY.equalTo(self.contentView);
            make.left.equalTo(self.contentView).offset(14);
    }];
    [self.contentView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(4, 44, 4, 4));
    }];
    
}
-(void)SQ_name:(NSString*)name seleted:(NSString*)seleted{
    self.messageLabel.text = name;
    if ([name isEqualToString:seleted]) {
        self.leftImage.image = SQGetImage(@"选择");
        self.messageLabel.textColor = UIColor.whiteColor;
      
    } else {
        self.messageLabel.textColor = SQColor999999;
       
        self.leftImage.image = SQGetImage(@"未选择");
    }
}
- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_REGULAR(14);
        _messageLabel.numberOfLines = 0;
//        _messageLabel.textAlignment = NSTextAlignmentCenter;
        _messageLabel.textColor = UIColor.whiteColor;
    }
    return _messageLabel;
}
- (UIImageView *)leftImage{
    if (!_leftImage) {
        _leftImage = [[UIImageView alloc]init];
        _leftImage.image = SQGetImage(@"未选择");
        _leftImage.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _leftImage;
}
@end
